home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Scope / Scope Disk #078 (199x)(Scope PD)(US)[WB].zip / Scope Disk #078 (199x)(Scope PD)(US)[WB].adf / SpeedUp / speedup.c < prev    next >
C/C++ Source or Header  |  1989-06-29  |  1KB  |  56 lines

  1. #include <exec/types.h>
  2. #include <exec/io.h>
  3. #define print(x) Write(stdout,x,sizeof(x))
  4.  
  5. extern long stdout,stdin;
  6. struct Port *diskport,*CreatePort();
  7. struct IOStdReq *diskreq,*CreateStdIO();
  8. char open,ob[10];
  9.  
  10. main(argc,argv)
  11. int argc;
  12. char **argv;
  13. {
  14.    register long *l,v,d=0;;
  15.  
  16.    if(strcmp(argv[1],"?")==0){
  17.       print("Format: speedup [df1:] [speed]\n");
  18.       exit(0);
  19.    }
  20.    diskport=CreatePort(0,0);
  21.    diskreq=CreateStdIO(diskport);
  22.    if(strcmp(argv[1],"df1:")==0){
  23.       argv++;
  24.       d=1;
  25.    }
  26.    open=OpenDevice("trackdisk.device",d,diskreq,0);
  27.    if(diskport && diskreq && !open){
  28.       l=(long *)(diskreq->io_Unit)+11;
  29.       print("\n\nTrackdisk steprate utility\n--------------------------\n");
  30.       print("Written in June '87 by M.Kegelmann\n\n");
  31.       print("Old value: ");
  32.       itoh(*l,ob);
  33.       aprints(stdout,ob);
  34.       if(argc>d+1){
  35.          v=htoi(*++argv);
  36.          if(v<0x500) print("Illegal operand.\n");
  37.          else {
  38.             *l=v;
  39.             print(" changed to value:");
  40.             aprints(stdout,*argv);
  41.             print("\n");
  42.          }
  43.       }
  44.       else do{
  45.          print(" New value (>=500):");
  46.          getlcli(stdin,ob,8);
  47.          if(*ob!='\0')
  48.             *l=htoi(ob);
  49.          print("\n");
  50.       }while(*l<0x500);
  51.    }
  52.    if(open==0) CloseDevice(diskreq);
  53.    if(diskreq) DeleteStdIO(diskreq);
  54.    if(diskport) DeletePort(diskport);
  55. }
  56.